<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>    
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<base href="<%=basePath%>">
<title>Insert title here</title>
<%@ include file="common.jsp" %>
<script type="text/javascript">
	$(function(){
		$("#nav").tree({
			onClick : function(node){
				console.log(node);
				if($("#tt").tabs("exists",node.text)){
					$("#tt").tabs("select",node.text);
					return;
				}
				$("#tt").tabs("add",{
					title: node.text,
					closable :true,
					content: "我是新来的",
					href:node.attributes.url
					
				});
			}
		});
	});
</script>
</head>
<body class="easyui-layout">
	<div class="header" data-options="region:'north'" style="height:50px;">
		<h1>简单的权限管理系统 <span style="font-size: 14px;">V1.0</span></h1>
	    	<div id="themes">
	    		<label> 欢迎${sessionScope.user.username }【<c:forEach items="${sessionScope.user.sysRoles}" var="u">
	    														${u.name }
	    													</c:forEach>】</label>
	    		<a href="sysUser/logout" onclick="return confirm('确定要退出吗，亲~~~~~~');">退出系统</a>
	    		<span class="theme1 active" title="gray"></span>
	    		<span class="theme2" title="black"></span>
	    		<span class="theme3" title="metro"></span>
	    		<span class="theme5" title="default"></span>
	    	</div>
	</div>
    <div data-options="region:'south'" style="height:20px;"></div>
    <div data-options="region:'west',title:'简单的权限管理系统菜单',split:true" style="width:200px;">
    	<ul class="easyui-tree" animate="true" id="nav">
    		
    		<c:forEach items="${sessionScope.permission_list }" var="parent">
    			<c:if test="${parent.parentId == null }">
	    			<li>
		    			<span>${parent.text }</span>
							<ul>
								<c:forEach items="${sessionScope.permission_list }" var="p">
									<c:if test="${p.parentId != null and p.parentId == parent.id}">
										<li data-options="attributes:{url:'${p.url }'}"><span>${p.text }</span></li>
									</c:if>
								</c:forEach>		    			
							</ul>
	    			</li>
    			
    			</c:if>
    			
    		</c:forEach>
    	</ul>
    	
    </div>
    <div data-options="region:'center'" style="padding:5px;background:#eee;">
    
    	<div id="tt" class="easyui-tabs" fit="true">
    	
    		<div title="首页">
    			欢迎进入
    		</div>
    		<div title="角色列表" data-options="closable:true,href:'sysRole/index'">
    			欢迎进入
    		</div>
    	</div>
    </div>
</body>
</html>